package com.fxb.bio.inputStream;

import java.io.*;

/**
 * 演示 FileInputStream的使用
 *
 * @author fangjiaxiaobai@gmail.coom
 * @version 1.0.0
 * @date 2019-12-22
 */
public class FileInputStreamDemo {

    public static void main(String[] args) throws IOException {
//        InputStream fileInputStream = FileInputStreamDemo.class.getResourceAsStream("aa.txt");
        FileInputStream fileInputStream = new FileInputStream("aa.txt");
        int read;
        try {
            while (-1 != (read = fileInputStream.read())) {
                System.out.println((char) read);
            }
        } catch (IOException e) {
            fileInputStream.close();
            System.out.println(e.getMessage());
        }

    }

}
